/**
 * Progetto PRAISED.
 * 13/dic/2010
 */
package it.uniroma3.dia.praised.pubmed.main;

import it.uniroma3.dia.praised.exception.CrawlerException;
import it.uniroma3.dia.praised.pubmed.crawler.CrawlerPubMed;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Accosta Augusto
 * @author Lopez Elisabetta
 *
 */
public class Main {

	private static final int PAGES_TO_BE_PROCESSED = 2;
	
	public Main() {
		
		System.out.println("Insert the query: ");
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader input = new BufferedReader(reader);
		
		String urlPage = "";
		String query = "";
		
		try {
			urlPage = "http://www.ncbi.nlm.nih.gov/sites/entrez?EntrezSystem2.PEntrez.Pmc.Pmc_LimitsTab.LimitsOff=true&amp;db=pmc&amp;cmd=search&amp;term=";
			query = input.readLine();
			
			CrawlerPubMed crawler = new CrawlerPubMed(urlPage, query);
			crawler.startup(PAGES_TO_BE_PROCESSED); // Il numero di pagine deve essere parametrico ma non pu� superare il valore delle pagine realmente esistenti
		} catch (IOException e) {
			e.printStackTrace();
		} catch (CrawlerException e) {
			e.printStackTrace();
		}
				
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		@SuppressWarnings("unused")
		Main main = new Main();
	}

}
